{* FILTERS *}

{literal}
<script language="javascript">
	function redirect(id) {
		var forma = document.getElementById("list_form");
		forma.action.value="spradmin";
		forma.id.value=id;
		forma.submit();
	}
	function updateRequest(id,action) {
		var forma = document.getElementById("list_form");
		forma.op.value=action;
		forma.id.value=id;
		forma.submit();
	}
	function startEdit(id,name,path) {
		var forma = document.getElementById("prj_form");
		forma.op.value='edit';
		forma.id.value=id;
		forma.name.value=name;
		forma.path.value=path;
		document.getElementById("edit_form").style.display = '';
		document.getElementById("add_form").style.display = 'none';
	}
	function cancelEdit() {
		var forma = document.getElementById("prj_form");
		forma.op.value='add';
		forma.name.value='';
		forma.path.value='';
		document.getElementById("edit_form").style.display = 'none';
		document.getElementById("add_form").style.display = '';
	}
</script>
{/literal}

<center>
<form method="post" id="prj_form">
	<input type="hidden" name="flowid" id="flowid" value="{$flowid}">
	<input type="hidden" name="action" id="action" value="pradmin">
	<input type="hidden" name="op" id="op" value="add">
	<input type="hidden" name="id" id="id" value="">	
	 <table width="100%" cellpadding="0" cellspacing="0">
	   <tr>
		 <td>&nbsp;{$lang.name}</td>
		 <td><input type="text" size="20" maxlength="20" name="name" id="name" class="txt"></td>
		</tr>
	   <tr>
		 <td>&nbsp;{$lang.path}</td>
		 <td><input type="text" size="50" maxlength="50" name="path" id="path" class="txt"></td>
		</tr>
		</tr>
			 <td align="right" colspan="2">
			 <div id="add_form">
			 {include file="button.tpl" name=$lang.new action="processForm('prj_form')"}
			 </div>
			 <div id="edit_form" style="display: none;">
			 {include file="button.tpl" name=$lang.ok action="processForm('prj_form')"}
			 &nbsp;{include file="button.tpl" name=$lang.cancel action="cancelEdit()"}
			 </div>
			 </td>
	   </tr>
	 </table>	
</form>
</center>


<center>
<table align="center" width="100%" border="0" cellpadding="0" cellspacing="0">

	<thead>
		<tr>
			<th>{$lang.name}</th>
			<th>{$lang.path}</th>
			<th>{$lang.status}</th>
			<th>&nbsp;</th>
		</tr>
	</thead>

	{* TABLE BODY - DYNAMIC *}
	<tbody>
		{assign var="rowclass" value="uneven"}
		{foreach from=$list item=row}
			{eval var=$row->status assign="stid"}
			<tr class="{$rowclass}" {if $stid neq 'ACTIVE'} style="font-style: italic" {/if}>
				<td>{$row->name}</td>
				<td>{$row->path}</td>				
				<td>{$lang.$stid}</td>
				<td>
					{if $stid eq 'ACTIVE'}
						<span onclick="updateRequest('{$row->id}','deact')" class="link">{$lang.deactivate}</span>&nbsp;
					{else}
						<span onclick="updateRequest('{$row->id}','act')" class="link">{$lang.activate}</span>&nbsp;
					{/if}
					<span onclick="startEdit('{$row->id}','{$row->name}','{$row->path}')" class="link">{$lang.edit}</span>&nbsp;
					<span onclick="redirect('{$row->id}')" class="link">{$lang.subprj}</span>
				</td> 
			</tr>
			{if $rowclass eq 'even'}
				{assign var="rowclass" value="uneven"}
			{else}
				{assign var="rowclass" value="even"}
			{/if}			
		{/foreach}

	</tbody>

</table>
<center>

<form method="post" id="list_form">
	<input type="hidden" name="action" id="action" value="pradmin">
	<input type="hidden" name="flowid" id="flowid" value="{$flowid}">		
	<input type="hidden" name="op" id="op" value="">	
	<input type="hidden" name="id" id="id" value="">
</form>